home *** CD-ROM | disk | FTP | other *** search
- Path: news.crd.ge.com!usenet
- From: Christopher R Volpe <volpe@ash.crd.ge.com>
- Newsgroups: comp.lang.c,comp.std.c
- Subject: Re: Integral conversion e.t.c. (was: Re: Hungarian notation)
- Date: Mon, 29 Jan 1996 08:35:48 -0500
- Organization: GE Corporate Research & Development, Schenectady, NY
- Message-ID: <310CCD34.2B72@ash.crd.ge.com>
- References: <30C40F77.53B5@swsbbs.com> <SPENCER.96Jan22113215@zorgon.ERA.COM> <KANZE.96Jan26164833@gabi.gabi-soft.fr> <DLtABq.Fzu@mv.mv.com> <4edqh2$rvl@solutions.solon.com>
- NNTP-Posting-Host: bart.crd.ge.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b4 (X11; I; SunOS 5.4 sun4m)
-
- Peter Seebach wrote:
- >
- > In article <DLtABq.Fzu@mv.mv.com>, Michael Furman <ENGR@GSSI.MV.COM> wrote:
- > [Re a rule forbidding extensions.]
- >
- > >My question was: is such rule exists?
- >
- > Sort of.
- >
- > There are two kinds of things called "legal" C. One is a strictly
- > conforming program, which must be accepted by, and work on, *any*
- > conforming C compiler. The other is merely a conforming
- > program, which must be accepted by, and work on, *at least one*
- > conforming compiler. The latter class is meaningless; FORTRAN is
- > conforming C. (gcc with g77 compiles it. Technically, gcc is not
- > quite conforming, but nothing is.)
- >
- > For purposes of the C newsgroups, discussion of what is/isn't legal
- > is generally restricted to strictly conforming C. Any extension
- > used allows a compiler to reject code.
-
- This is not quite true. There is another class of programs which
- officially has no name but a bunch of regulars on comp.std.c had adopted
- the names "strongly conforming" and "portably conforming" to describe
- it. It is the class of programs that contain no syntax errors or
- constraint violations, and does not invoke undefined behavior. They may
- rely upon unspecified or implementation-defined behavior, however. These
- programs must work "properly" on amy implementation, but the definition
- of "properly" varies from implementation to implementation. The vast
- majority of real C software fits into this category, or can be made to
- fit into this category through bug fixes. (In other words, it may be
- impossible to make real practical software "strictly conforming", but it
- should always be possible to make real practical software "strongly
- conforming". ) It would be nice to see this terminology officially
- adopted in the next Standard.
-
- Here's an example of a non-strictly-conforming program that no compiler
- is allowed to reject (mod any obvious typos I may make here):
-
- #include <stdio.h>
- int h()
- {
- printf("Hello"); return 0;
- }
- int g()
- printf("Goodbye"); return 0;
- }
- void foo(int a, int b)
- {
- }
- int main()
- {
- foo(h(),g());
- }
-
- The output of this program can be either "HelloGoodbye" or
- "GoodbyeHello", but not "Segmentation violation (core dumped)".
-
- --
-
- Chris Volpe Phone: (518) 387-7766 (Dial Comm 8*833
- GE Corporate R&D Fax: (518) 387-6560
- PO Box 8, Schenectady, NY 12301 Email: volpecr@crd.ge.com
-